import { useState } from "react";
import { Navigate } from "react-router-dom";

const Nav = () => {
    const [login, setLogin] = useState(false);
    return (
        <>
            {login ? (
                <Navigate to='/dashboard' />
            ) : (
                <div>
                    <div className='alert alert-info'>Navigate页面</div>
                    <div
                        className='btn btn-block btn-danger'
                        onClick={() => setLogin(true)}
                    >
                        登录
                    </div>
                </div>
            )}
        </>
    );
};

export default Nav;
